//
//  TLEventView.m
//  TLEventView
//
//  Created by telen on 16/4/19.
//  Copyright © 2016年 telen. All rights reserved.
//

#import "TLEventView.h"

@implementation TLEventView

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
    if (_eventType == TLViewEvent_all) {
        return YES;
    }
    if (_eventType == TLViewEvent_never) {
        return NO;
    }
    if (CGRectContainsPoint(self.bounds, point)) {
        NSArray* subviews = [self subviews];
        for (UIView* view in subviews) {
            if (CGRectContainsPoint(view.frame, point)) {
                return YES;
            }
            if ([view pointInside:point withEvent:event]) {
                return YES;
            }
        }
    }
    return NO;
}

@end
